#ifndef GATE_CONNECTOR_IMPL_H
#define GATE_CONNECTOR_IMPL_H

#include "gate_module.h"
#include "gate_connector_event_handler.h"
namespace utility
{
namespace network
{
    class gate_connector_impl :public gate_connector
    {
    public:
        // standard constructor
        gate_connector_impl(net_module * netmodule);

        // standard destructor
        ~gate_connector_impl(void);
    public:
        // initialize
        virtual bool initialize(session_mgr *);

        // connect to gate listener before establishing the connection between client and server
        virtual bool connect_listener(const char * ip_address, const char * port);

        // establish the connection between client and server
        virtual bool connect(uint32 client_ip, uint16 client_port);

        virtual void release() {delete this;}

        session_mgr * get_session_mgr();

    private:
        session * _get_session();

    protected:
        session_mgr * session_mgr_;
        connector * connector_;
        gate_connector_event_handler event_handler_;
    };
}
}


#endif // endif of GATE_CONNECTOR_IMPL_H
